/**
 *
 */
package org.come.summonequip;

import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;

import javax.swing.BorderFactory;
import javax.swing.JInternalFrame;
import javax.swing.plaf.basic.BasicInternalFrameUI;

import org.come.until.FormsManagement;
import org.come.until.Music;

import com.tool.tcpimg.UIUtils;

/**
 * 兑换奖励主面板<br>
 * 编号：92
 * <p>
 * Title : JframeSummonEquipMain
 * </p>
 *
 * @author : HGC
 * @date : 2019年7月19日 下午2:47:57
 * @version : 1.0.0
 */
public class JframeCashRewardsMain extends JInternalFrame implements MouseListener {

	private int first_x, first_y;// x、y坐标

	private JpanelCashRewardsMain jpanelCashRewardsMain;

	/**
	 * 实例化界面
	 *
	 * @return
	 */
	public static JframeCashRewardsMain getJframeCashRewardsMain() {
		return (JframeCashRewardsMain) FormsManagement.getInternalForm(92).getFrame();
	}

	public JframeCashRewardsMain() {
		super();
		jpanelCashRewardsMain = new JpanelCashRewardsMain();
		this.add(jpanelCashRewardsMain);
		this.setBorder(BorderFactory.createEmptyBorder());// 去除内部窗体的边框
		((BasicInternalFrameUI) this.getUI()).setNorthPane(null);// 去除顶部的边框
		this.setBounds(500, 110, 561, 537);
		this.setOpaque(false);
		this.pack();
		this.setBackground(UIUtils.Color_BACK);
		this.setVisible(false);

		this.addMouseMotionListener(new MouseMotionListener() {// 判断窗口移动的位置

			@Override
			public void mouseMoved(MouseEvent e) {
			}

			@Override
			public void mouseDragged(MouseEvent e) {
				if (getJframeCashRewardsMain().isVisible()) {
					int x = e.getX() - first_x;
					int y = e.getY() - first_y;
					getJframeCashRewardsMain().setBounds(x + getJframeCashRewardsMain().getX(), y + getJframeCashRewardsMain().getY(),
							getJframeCashRewardsMain().getWidth(), getJframeCashRewardsMain().getHeight());
				}
			}
		});
		this.addMouseListener(this);
	}

	@Override
	public void mouseClicked(MouseEvent e) {
	}

	@Override
	public void mousePressed(MouseEvent e) {
		// 开启窗口音效
		Music.addyinxiao("关闭窗口.mp3");
		if (e.isMetaDown()) {// 检测鼠标右键单击
			// 关闭窗口音效
			// Music.addyinxiao("关闭窗口.mp3");
			FormsManagement.HideForm(92);

		} else {
			FormsManagement.Switchinglevel(92);
		}
		this.first_x = e.getX();
		this.first_y = e.getY();

	}

	@Override
	public void mouseReleased(MouseEvent e) {
	}

	@Override
	public void mouseEntered(MouseEvent e) {
	}

	@Override
	public void mouseExited(MouseEvent e) {
	}

	public int getFirst_x() {
		return first_x;
	}

	public void setFirst_x(int first_x) {
		this.first_x = first_x;
	}

	public int getFirst_y() {
		return first_y;
	}

	public void setFirst_y(int first_y) {
		this.first_y = first_y;
	}

	public JpanelCashRewardsMain getJpanelCashRewardsMain() {
		return jpanelCashRewardsMain;
	}

	public void setJpanelCashRewardsMain(JpanelCashRewardsMain jpanelCashRewardsMain) {
		this.jpanelCashRewardsMain = jpanelCashRewardsMain;
	}

}
